home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / setprotection.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  77 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: setprotection.c,v 1.1 1996/09/11 12:54:47 digulla Exp $
  4.     $Log: setprotection.c,v $
  5.     Revision 1.1  1996/09/11 12:54:47  digulla
  6.     A couple of new DOS functions from M. Fleischer
  7.  
  8.     Desc:
  9.     Lang: english
  10. */
  11. #include <clib/exec_protos.h>
  12. #include <dos/dosextens.h>
  13. #include <dos/filesystem.h>
  14. #include <clib/dos_protos.h>
  15. #include "dos_intern.h"
  16.  
  17. /*****************************************************************************
  18.  
  19.     NAME */
  20.     #include <clib/dos_protos.h>
  21.  
  22.     __AROS_LH2(BOOL, SetProtection,
  23.  
  24. /*  SYNOPSIS */
  25.     __AROS_LHA(STRPTR, name,    D1),
  26.     __AROS_LHA(ULONG,  protect, D2),
  27.  
  28. /*  LOCATION */
  29.     struct DosLibrary *, DOSBase, 31, Dos)
  30.  
  31. /*  FUNCTION
  32.  
  33.     INPUTS
  34.     name    - name of the file
  35.     protect - new protection bits
  36.  
  37.     RESULT
  38.     !=0 if all went well, 0 else. IoErr() gives additional
  39.     information in that case.
  40.  
  41.     NOTES
  42.  
  43.     EXAMPLE
  44.  
  45.     BUGS
  46.  
  47.     SEE ALSO
  48.  
  49.     INTERNALS
  50.  
  51.     HISTORY
  52.     29-10-95    digulla automatically created from
  53.                 dos_lib.fd and clib/dos_protos.h
  54.  
  55. *****************************************************************************/
  56. {
  57.     __AROS_FUNC_INIT
  58.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  59.  
  60.     /* Get pointer to process structure */
  61.     struct Process *me=(struct Process *)FindTask(NULL);
  62.  
  63.     /* Get pointer to I/O request. Use stackspace for now. */
  64.     struct IOFileSys io,*iofs=&io;
  65.  
  66.     /* Prepare I/O request. */
  67.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  68.     iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  69.     iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  70.     iofs->IOFS.io_Flags=0;
  71.     iofs->IOFS.io_Command=FSA_SET_PROTECT;
  72.     /* io_Args[0] is the name which is set by DoName(). */
  73.     iofs->io_Args[1]=protect;
  74.     return !DoName(iofs,name);
  75.     __AROS_FUNC_EXIT
  76. } /* SetProtection */
  77.